package com.zengqingfa.juc.n3;

import lombok.extern.slf4j.Slf4j;

/**
 * @author zengqingfa
 * @className TestRunAndStart
 * @description
 * @create 2021/6/6 13:28
 */

@Slf4j(topic = "c.TestRunAndStart")
public class TestRunAndStart {

    public static void main(String[] args) {
        Thread thread = new Thread("t1") {
            @Override
            public void run() {
                log.debug("runing");
            }
        };
        //主线程
        //13:32:47 [main] c.TestRunAndStart - runing
        thread.run();
        //开启一个线程，并运行run方法中的代码
        //13:32:47 [t1] c.TestRunAndStart - runing
        thread.start();
        //Exception in thread "main" java.lang.IllegalThreadStateException
        //	at java.lang.Thread.start(Thread.java:708)
        //	at com.zengqingfa.juc.n3.TestRunAndStart.main(TestRunAndStart.java:29)
        thread.start();
    }
}